// import axios from 'axios'
import qs from 'qs'
import request from './request'

// 精品推荐接口
export const JingpinApi = () => request.get('/products/recommend')

// 热门兑换 /products/hot
export const HotApi = () => request.get("/products/hot")

// 发送注册短信验证码 /sendSMS (npm i qs 或者 yarn add qs)
export const getCodeApi = (params) => request.post('/sendSMS', qs.stringify(params))

// 手机号验证码登录(含注册) /phoneRegin
export const LoginApi = (params) => request.post('/phoneRegin', qs.stringify(params))

// 获取用户信息 /shop/userProfiles
export const UserInfoApi = () => request.get('/shop/userProfiles')

// 微信扫码登录 /wechatUsers/PCLogin
export const WeiXinLoginApi = (params) => request.post('/wechatUsers/PCLogin', qs.stringify(params))

// 手机绑定微信 /wechatUsers/binding
export const BindWechatApi = (params) => request.post('/wechatUsers/binding', qs.stringify(params))

// 手机解绑微信 （登录状态下）
export const UnBindWechatApi = () => request.put('/wechatUsers/unbindingWeChat')

// 商品页数据请求
export const GoodsDataApi = (params) => request.get('/products', {
    params
})

// 商品详情接口
export const GoodsDetailsApi = (params) => request.get(`/products/${params.id}`)
//加入购物车接口
export const AddCartApi=(params)=>request.post('/shop/carts/add',qs.stringify(params))